﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:timeline="clr-namespace:TimelineLibrary;assembly=TimelineLibrary"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:s="clr-namespace:System;assembly=mscorlib"
    mc:Ignorable="d">
	<s:Int32
        x:Key="TooltipTimeout">60</s:Int32>
    <LinearGradientBrush x:Key="EventTooltipBackground" StartPoint="0,0" EndPoint="0,1">
		<GradientStop Color="White" Offset="0"/>
		<GradientStop Color="Silver" Offset="1"/>
	</LinearGradientBrush>

    <timeline:NullToUnsetConverter
        x:Key="NullToUnsetConverter"></timeline:NullToUnsetConverter>

    <SolidColorBrush
        x:Key="EventTooltipTitleForeground">Black</SolidColorBrush>

	<SolidColorBrush
        x:Key="EventTooltipDescriptionForeground">Black</SolidColorBrush>
	<SolidColorBrush
        x:Key="ItemLineBrush">#FF444444</SolidColorBrush>
	<SolidColorBrush
        x:Key="ItemBackground">#E9ECFAFF</SolidColorBrush>

	<SolidColorBrush
        x:Key="ItemForeground">White</SolidColorBrush>
	<SolidColorBrush
        x:Key="BandEventTitleForeground">Black</SolidColorBrush>

	<SolidColorBrush
        x:Key="BandTeaserForeground">Silver</SolidColorBrush>

	<ControlTemplate
        x:Key="EventTooltipStyle"
        TargetType="ToolTip">
		<Border
            BorderBrush="Silver"
            BorderThickness="1"
            Background="{StaticResource EventTooltipBackground}">
			<StackPanel
                Margin="5"
                MaxWidth="400">

				<TextBlock
                    Margin="0,0,0,0"
                    Text="{Binding Event.Title, Mode=OneWay}"
                    MinWidth="{Binding EventPixelWidth}"
                    TextWrapping="NoWrap"
					FontWeight="Bold"
					FontSize="12"
                    Foreground="{StaticResource EventTooltipTitleForeground}"
                    HorizontalAlignment="Left">
				</TextBlock>

				<TextBlock
                    Margin="0,0,0,0"
                    Text="{Binding Event.Description, Mode=OneWay}"
                    TextWrapping="Wrap"
                    Foreground="{StaticResource EventTooltipDescriptionForeground}"
                    FontStyle="italic"
                    HorizontalAlignment="Left"
                    FontSize="11">
				</TextBlock>
			</StackPanel>
		</Border>
	</ControlTemplate>
	<DataTemplate
        x:Key="TimelineEventStyle">

			<Grid
                        x:Name="EventTemplateRoot"
                        MinWidth="226">
				<Grid.RowDefinitions>
					<RowDefinition
                                Height="6" />
					<RowDefinition
                                Height="*" />
					<RowDefinition
                                Height="20000" />
				</Grid.RowDefinitions>
				<Grid.ColumnDefinitions>
					<ColumnDefinition
                                Width="6" />
					<ColumnDefinition
                                Width="220" />
				</Grid.ColumnDefinitions>

				<Canvas
                            Grid.Row="0"
                            Grid.Column="0"
                            Height="6"
                            Width="6"
                            Margin="0">
					<Rectangle
                                x:Name="EventDurationRect"
                                Canvas.Left="0"
                                Canvas.Top="0"
                                Height="6"
                                MinWidth="6"
                                Width="{Binding EventPixelWidth, Mode=OneWay}"
                                Fill="{Binding EventColorBrush, Mode=OneWay}"
                                RadiusX="3"
                                RadiusY="3">
						<timeline:TooltipServiceEx.ToolTipEx>
							<timeline:ToolTipEx
                                        HideToolTipTimeout="{StaticResource TooltipTimeout}" />
						</timeline:TooltipServiceEx.ToolTipEx>
						<ToolTipService.ToolTip>
							<ToolTip
                                        Template="{StaticResource EventTooltipStyle}" />
						</ToolTipService.ToolTip>
					</Rectangle>
				</Canvas>

				<Border
                            Grid.Column="1"
                            Grid.Row="1"
                            Padding="2 2 2 2"
                            BorderThickness="{Binding SelectionBorder}"
                            Margin="2 2 2 2"
					        CornerRadius="4"
                            BorderBrush="{StaticResource ItemLineBrush}"
                            Background="{StaticResource ItemBackground}">

					<StackPanel
                                Margin="0"
                                Orientation="Vertical"
                                Width="220">

						<Image
                                x:Name="EventImage"
                                Source="{Binding Event.TeaserEventImage, Converter={StaticResource NullToUnsetConverter}}"
                                Width="Auto"
                                Height="Auto"
                                Stretch="None"
                                Margin="0 1 0 0"
                                HorizontalAlignment="Left">
							<timeline:TooltipServiceEx.ToolTipEx>
								<timeline:ToolTipEx
                                            HideToolTipTimeout="{StaticResource TooltipTimeout}" />
							</timeline:TooltipServiceEx.ToolTipEx>
							<ToolTipService.ToolTip>
								<ToolTip
                                            Template="{StaticResource EventTooltipStyle}" />
							</ToolTipService.ToolTip>
						</Image>

						<StackPanel
                                    Margin="2 0 0 0"
                                    Orientation="Vertical"
                                    Width="Auto">
							<!--Foreground="{StaticResource BandEventTitleForeground}"-->

						<TextBlock
                                x:Name="EventTitleTextBlock"
                                Margin="0 3 0 0"
                                TextWrapping="Wrap"
                                Foreground="Black"
                                FontFamily="Arial"
                                FontWeight="Bold"
                                Text="{Binding Event.Title, Mode=OneWay}"
                                FontSize="12">
						</TextBlock>

						<TextBlock
                                        x:Name="EventTeaserBlock"
                                        Margin="0,0,0,0"
                                        Text="{Binding Teaser, Mode=OneWay}"
                                        TextWrapping="Wrap"
                                        Foreground="{StaticResource BandTeaserForeground}"
                                        FontStyle="italic"
                                        Height="Auto"
                                        HorizontalAlignment="Left"
                                        FontSize="9.25">
                                        
                                        <timeline:TooltipServiceEx.ToolTipEx>
                                            <timeline:ToolTipEx
                                                HideToolTipTimeout="{StaticResource TooltipTimeout}" />
                                        </timeline:TooltipServiceEx.ToolTipEx>
                                        <ToolTipService.ToolTip>
                                            <ToolTip
                                                Template="{StaticResource EventTooltipStyle}" />
                                        </ToolTipService.ToolTip>

							</TextBlock>

							<timeline:Hyperlink
                                        x:Name="EventLinkTextBlock"
                                        Margin="0,0,0,0"
                                        Visibility="{Binding MoreLinkVisibility, Mode=OneWay}"
                                        Content="{Binding LinkText, Mode=OneWay}"
                                        HorizontalAlignment="Left"
                                        FontStyle="italic"
                                        FontSize="9.25">
							</timeline:Hyperlink>
						</StackPanel>

					</StackPanel>
				</Border>

				<Border
                            x:Name="BorderLine"
                            Canvas.ZIndex="-1"
                            Grid.Row="0"
                            Grid.RowSpan="3"
                            Grid.Column="0"
					        CornerRadius="2"
                            VerticalAlignment="Stretch"
                            Width="1"
                            Background="{Binding EventColorBrush}" />

			</Grid>

		</DataTemplate>
</ResourceDictionary>